package de.yvert.jingle.impl.openexr;

import java.util.Arrays;
import java.util.List;

public class ChannelList
{

private Channel[] channels;

public ChannelList(Channel[] channels)
{ this.channels = channels; }

public ChannelList(List<Channel> channels)
{ this.channels = channels.toArray(new Channel[0]); }

public int size()
{ return channels.length; }

public Channel get(int i)
{ return channels[i]; }

public Channel[] getChannels()
{ return channels; }

public int getLineLength(int width)
{
	int result = 0;
	for (Channel c : channels)
		result += c.getLineLength(width);
	return result;
}

public int getOffset(int index, int width)
{
	int result = 0;
	for (int i = 0; i < index; i++)
		result += channels[i].getLineLength(width);
	return result;
}

@Override
public String toString()
{ return Arrays.toString(channels); }

}
